#include <memory>
#include <binders.h>

#include "UdpSever.hpp"
#include "Dict.hpp"

int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        LOG(FATAL, "too few arguments in cmd\n");
        exit(1);
    }
    uint16_t clientPort = std::stoi(argv[1]);

    Dict dict;
    func_t route = std::bind(&Dict::translate, &dict, std::placeholders::_1,std::placeholders::_2);
    std::unique_ptr<UdpSever> usvr = std::make_unique<UdpSever>(route,clientPort); // c++14的标准

    usvr.operator->()
        ->Init();
    usvr->Start();
}